package com.apes.fn.scm.settleCheck.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import com.apes.framework.util.DateUtil;
import com.apes.scm.masterdata.enumeration.model.Enumeration;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import java.util.Date;

/**
 * 功能：其他代收款项
 *
 * @author zhuyh
 * @time 19:30
 * @date 2020/5/13
 */
@Deprecated
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = RclOtherPayment.CONST_TABLE_NAME)
public class RclOtherPayment extends Model {


    public static final String CONST_TABLE_NAME = "fn_other_payment";

    @Id
    @Column(name = "id", nullable = false, length = 24)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "支付款汇总单号", padding = 12)
    private String id;

    @Column(name = "business_type", length = 250)
    @Comment("业务类型")
    private String businessType;


    @Column(name = "business_classifiction", length = 250)
    @Comment("业务分类")
    private String businessClassifiction;



    @ManyToOne(optional = false)
    @JoinColumn(name = "partner_Account_Statement_id", referencedColumnName = "id", nullable = false)
    @Comment("赋能对账单号")
    private RclPartnerAccountStatement rclPartnerAccountStatement;


    @Column(name = "money", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("金额")
    private double money = 0.0;//

    @Column(name = "marker", length = 250)
    @Comment("差异说明")
    private String marker;

    @Column(name = "comfirm",columnDefinition = "number(1,0) default 1")
    @Comment("确认")
    private Integer comfirm;

    @JSONField(format = DateUtil.SHOW_DATETIME_FORMAT)
    @Temporal(TemporalType.DATE)
    @Column(name = "start_date")
    @Comment("业务期间起")
    private Date startDate; //业务期间起

    @JSONField(format = DateUtil.SHOW_DATETIME_FORMAT)
    @Temporal(TemporalType.DATE)
    @Column(name = "end_date")
    @Comment("业务期间止")
    private Date endDate; //业务期间止

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "agent_payment_item", referencedColumnName = "id")
    @Comment("代支付项目")
    private Enumeration agentPaymentItem;

    @Column(name = "paytype",columnDefinition = "number(2,0) default 1")
    @Comment("支付类型")
    private Integer paytype;

}
